<!--
    Desenvolvido pela Fábrica de Software do CESUPA.
    Todos os direitos reservados.

    @author Breno Leite
-->

<ui:component xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:a4j="http://richfaces.org/a4j"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:c="http://java.sun.com/jstl/core">

    <!--============================================================================
    FIELD MESSAGE
    ============================================================================
    Used to provide information about one form field.

    @param  type the type of the message. Accepted values: info, general,
    validation.
    =========================================================================-->

    <c:if test="${type == 'info'}">
        <h:graphicImage url="/images/icons/info-message-16x16.gif"
                        width="12" height="12" style="margin-top:2px;margin-right:3px;"
                        alt="info marker"/>
        <h:outputText styleClass="field-info-message" value="${text}"/>
        <br/>
    </c:if>

    <c:if test="${type == 'general'}">
        <h:outputText styleClass="field-general-message" value="${text}"/>
        <br/>
    </c:if>

    <!--========================================================================
    Message type "validation" has a special behaviour. It only appear if some
    error occur with the field data validation. It is imperative to inform the
    "for" parameter. The target field must have a "label" parameter containing
    its name.

    @param  type
    =========================================================================-->
    <c:if test="${type == 'validation'}">
        <rich:message escape="true" styleClass="field-error-message" for="${for}">
            <f:facet name="errorMarker">
                <h:graphicImage url="/images/icons/error-16x16.gif"
                                width="12" height="12" style="margin-right:3px;"
                                alt="error marker"/>
            </f:facet>
        </rich:message>
        <br/>
    </c:if>
</ui:component>